<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2018/12/7
 * Time: 10:08
 */

namespace app\api\controller\v1;

use app\api\controller\BaseController;
use \app\api\service\Token as TokenService;
use Driver\Cache\Redis;

class Token extends BaseController
{
    # 获取token
    public function getToken($username)
    {
        $tokenService = new TokenService;
        $tokenScope = $tokenService->getToken($username);
        return $tokenScope;
    }
    # 检查token是否过期
    public function verifyToken()
    {
        $exist = TokenService::getRedisTokenName();
        if(!$exist){
            return json(['code' => 404]);
        }
        return json(['code' => 200]);
    }
}